﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Data.Interfaces;
using System.ServiceModel;
using Data.Interfaces.Callback;
using Data.Characters;
using Data;

namespace Server.Services
{
    [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant)]
    class GameService:IGameService
    {
        public void testWcf(string test, int testInt)
        {
            int t = testInt;
            string tt = test;
            OperationContext.Current.GetCallbackChannel<ICGameService>().testCallback("test", 1);
        }

        public void setReadyPlayer(string pseudo, string name)
        {
            ICGameService callback = OperationContext.Current.GetCallbackChannel<ICGameService>();
            if (!MainWindow.listGameCallBacks.Contains(callback))
            {
                MainWindow.listGameCallBacks.Add(callback);
                Player player = new Player(pseudo);
                switch (name)
                {
                    case "Matthieu":
                        player.character = new Matthieu();
                        break;
                    case "Mage":
                        player.character = new Mage();
                        break;
                    case "Priest":
                        player.character = new Priest();
                        break;
                    case "War":
                        player.character = new War();
                        break;
                }
                MainWindow.ListPlayers.Add(player);
            }
        }
    }
}
